﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using MvcContrib.TestHelper;
using ProgressTracker.WebUI.Controllers;
using ProgressTracker.WebUI.Models.Home;

using System.Web.Mvc;

namespace ProgressTracker.Tests.Controllers
{
    [TestClass]
    public class HomeControllerTests
    {
        [TestMethod]
        public void Test_Index_Correctly_Returns_View()
        {
            var homeController = new HomeController();
            var result = homeController.Index();

            result.AssertViewRendered();
        }

        [TestMethod]
        public void Test_Index_Passes_Message_In_TempData()
        {
            var homeController = new HomeController();
            homeController.TempData["Message"] = "Test";

            var result = homeController.Index();

            var model = ((ViewResult)result).ViewData.Model as IndexModel;

            Assert.AreEqual("Test", model.Message);
        }
    }
}
